package com.example.shop_2212

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.setupWithNavController
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.example.base.mvvm.BaseViewActivity
import com.example.shop_2212.databinding.ActivityShopBinding
@Route(path = "/app/ShopActivity")
class ShopActivity : BaseViewActivity<ActivityShopBinding>() {
    @Autowired
    @JvmField
    var index = 0
    override fun initView() {
        ARouter.getInstance().inject(this)
        //找到navHostFragment
        val navHostFragment = supportFragmentManager.findFragmentById(R.id.fragmentContainerView) as NavHostFragment
        //找到navController
        val navController = navHostFragment.navController
        //联动
        binding.bottom.setupWithNavController(navController)

        when(index){
            0-> binding.bottom.selectedItemId = R.id.homeFragment
            1-> binding.bottom.selectedItemId = R.id.categoryFragment
            2-> binding.bottom.selectedItemId = R.id.carFragment
            3-> binding.bottom.selectedItemId = R.id.mineFragment
        }
    }

    override fun initData() {

    }

    override fun getLayout(): Int  = R.layout.activity_shop

}